package com.mlf.prototype.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PrototypeController {

    @Autowired
    private SingletonWithLookup singletonWithLookup;

    @Autowired
    private SingletonWithObjectProvider singletonWithObjectProvider;

    @Autowired
    private SingletonWithScopedProxy singletonWithScopedProxy;

    @Autowired
    private SingletonWithFakePrototypeBean singletonWithFakePrototypeBean;

    @GetMapping("/prototypeByLookup")
    public void prototypeByLookup() {
        singletonWithLookup.doSomething();
    }

    @GetMapping("/prototypeByObjectProvider")
    public void prototypeByObjectProvider() {
        singletonWithObjectProvider.getBean();
    }

    @GetMapping("/prototypeByScopedProxy")
    public void prototypeByScopedProxy() {
    	singletonWithScopedProxy.demonstratePrototype();
    }

    @GetMapping("/prototypeByFakePrototypeBean")
    public void prototypeByFakePrototypeBean() {
    	singletonWithFakePrototypeBean.demonstratePrototype();
    }


}
